//package com.cd.common.util.kafka;
//
//import org.apache.kafka.clients.consumer.KafkaConsumer;
//import org.apache.kafka.clients.producer.KafkaProducer;
//import org.apache.kafka.clients.producer.Producer;
//import org.apache.kafka.clients.producer.ProducerConfig;
//
//import java.util.Properties;
//
//public class KafkaProducerUtils {
//
//    public static Producer<String, String> getGoodOrdersKafkaProducer() {
//        Properties props = new Properties();
//        props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
//        props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer");
//        props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer");
//        Producer<String, String> producer=new KafkaProducer<String, String>(props);
//        return producer;
//    }
//
//    public static KafkaConsumer<String, String> getGoodOrdersKafkaConsumer() {
//        Properties props = new Properties();
//        props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
//        props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer");
//        props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, "org.apache.kafka.common.serialization.StringSerializer");
//        props.put("group.id", "test-group");
//        props.put("java.deserialization.settings", "true"); // 确保反序列化开启
//        KafkaConsumer<String, String> consumer=new KafkaConsumer<String, String>(props);
//        return consumer;
//    }
//}
